﻿namespace Normalify
{
    public interface IDataRow
    {
        int Id { get; }
        object Get(IDataColumn column);
    }

	internal class ForwardDqDataRow : IDataRow
	{
		private readonly int _id;

		public ICurrentDataReader Owner { get; private set; }

		public ForwardDqDataRow(ICurrentDataReader owner, int id)
		{
			Owner = owner;
			_id = id;
		}

		public int Id
		{
			get { return _id; }
		}

		public object Get(IDataColumn column)
		{
			return Owner.Read(column);
		}
	}

    internal class DqDataRow : IDataRow
    {
        private readonly int _id;

        public IDataReader Owner { get; private set; }

        public DqDataRow(IDataReader owner, int id)
        {
            Owner = owner;
            _id = id;
        }
        
        public int Id
        {
            get { return _id; }
        }

        public object Get(IDataColumn column)
        {
            return Owner.Read(this, column);
        }
    }
}